// 2. src/store/index 创建store createStore
import { applyMiddleware, legacy_createStore as createStore } from 'redux';
import { rootReducer } from './reducer';

import logger from 'redux-logger';
import thunk from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension';

// 创建 store时候，通过 applyMiddleware(logger) ，说明需要使用中间件
// 口诀： 工具 - 应用 - 中间件
const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
);

export default store;
